package cn.kai.ymcc.feign;

import cn.kai.ymcc.doc.CourseDoc;
import cn.kai.ymcc.result.JSONResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "service-search", fallbackFactory = CourseSearchFeignClientFallBackFactory.class)
public interface CourseSearchFeignClient {

    /**
     * feign调用ES接口保存课程到Es
     * @param doc
     * @return
     */
    @PostMapping("/saveCourse")
    JSONResult saveCourse(@RequestBody CourseDoc doc);

    /**
     * feign调用ES接口删除下架课程
     * @param courseId
     * @return
     */
    @PostMapping("/offLineCourse")
    public JSONResult offLineCourse(@RequestParam Long courseId);
}
